package com.woniuxy.authapp.client;

import com.woniuxy.authapp.client.param.Oauth2TokenInfo;
import com.woniuxy.authapp.client.param.loginInfo;
import com.woniuxy.commons.util.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Mr.zhou
 * \* Date: 2022/8/6
 * \* Time: 20:28
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
@FeignClient(contextId = "AuthClient",name="yoga-auth",path="/auth")
@Component
public interface AuthClient {


    @ApiOperation("Oauth2获取token")
    @RequestMapping(value = "/oauth/token",method = RequestMethod.POST)
    public Result<Oauth2TokenInfo> postAccessToken(
            @RequestParam String grant_type, @RequestParam String client_id,
            @RequestParam String client_secret,
            @RequestParam(required = false) String refresh_token,
            @RequestParam(required = false) String username,
            @RequestParam(required = false) String password) throws HttpRequestMethodNotSupportedException;


//    @ApiOperation("登录")
//    @PostMapping(value = "/login")
//    public Result login(@RequestBody loginInfo loginInfo) throws HttpRequestMethodNotSupportedException;


    @ApiOperation(("登出"))
    @RequestMapping(value = "/logout",method = RequestMethod.POST)
    public Result logout();

}
